#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;

class Solution {
public:
    int findMin(vector<int>& nums) {
        //凑出数组nums的二段性
        if(nums.empty()){
            return 0;
        }
        if(nums.size()==1){
            return nums[0];
        }
        int l = 0;
        int r = nums.size()-1;
        while(nums[0]==nums[r]){
            --r;
        }

        while(l<=r){
            int mid = (l+r)/2;
            if(nums[mid]<nums[0]){
                r= mid-1;
            }
            else{
                l = mid+1;
            }
        }
        int index = 0;
        if(l>=0&&l<nums.size()){
            index = l;
        }
        return nums[index];
    }   
};

int main(){
    Solution S;
    vector<int> nums = {1};
    cout<<S.findMin(nums)<<endl;
}
